find frequency of each character in a string